# $Id: CMakeLists.txt 530 2008-06-03 10:01:56Z avenger $
# CMakeLists for selve byggingen og installasjon av ml278
#
# ml278
# Copyright (C) 2008 Bjørn Øivind Bjørnsen, Aleksander Gjermundsen, Knut Andre Tidemann, Thomas Hansen
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

# Sources used
set(PLANETARYSCENEMANAGER_DIR PlanetarySceneManager)
set(ML278_SOURCES main.cpp application.cpp keybindingsmanager.cpp extendedcamera.cpp loadingbar.cpp baseworldobject.cpp spaceship.cpp guimenu.cpp colshapemanager.cpp physicsinfo.cpp physicsmanager.cpp colladaphysicsloader.cpp eventmanager.cpp eventlistener.cpp planetarydynamicsworld.cpp
	${PLANETARYSCENEMANAGER_DIR}/planetaryscenemanager.cpp ${PLANETARYSCENEMANAGER_DIR}/planetaryoptions.cpp ${PLANETARYSCENEMANAGER_DIR}/planetarypage.cpp ${PLANETARYSCENEMANAGER_DIR}/planetarytile.cpp
	${PLANETARYSCENEMANAGER_DIR}/planetaryrenderable.cpp ${PLANETARYSCENEMANAGER_DIR}/planetaryzone.cpp ${PLANETARYSCENEMANAGER_DIR}/planetaryplanet.cpp ${PLANETARYSCENEMANAGER_DIR}/planetaryheightmapdata.cpp
	${PLANETARYSCENEMANAGER_DIR}/planetarypagerenderable.cpp ${PLANETARYSCENEMANAGER_DIR}/planetaryzonerenderable.cpp ${PLANETARYSCENEMANAGER_DIR}/planetaryindexbuffermanager.cpp
	${PLANETARYSCENEMANAGER_DIR}/planetaryatmosphere.cpp ${PLANETARYSCENEMANAGER_DIR}/planetaryatmosphererenderable.cpp ${PLANETARYSCENEMANAGER_DIR}/planetarylodjoint.cpp
	${PLANETARYSCENEMANAGER_DIR}/planetarypagelodjoint.cpp ${PLANETARYSCENEMANAGER_DIR}/planetarybody.h
   )

# Platform independant package finder for windows (does not work atm)
#IF(WIN32 AND NOT UNIX)
#	set(BULLET_DIR CMakeModules)
#	set(OGRE_DIR CMakeModules)
#	set(OIS_DIR CMakeModules)

#	find_package(BULLET REQUIRED)
#	find_package(OGRE REQUIRED)
#	find_package(OIS REQUIRED)
#ELSE(WIN32 AND NOT UNIX)
	# For pkg-config
	INCLUDE(${CMAKE_ROOT}/Modules/FindPkgConfig.cmake)

	pkg_check_modules(OGRE REQUIRED OGRE)
	pkg_check_modules(BULLET REQUIRED bullet)
	pkg_check_modules(OIS REQUIRED OIS)
	add_definitions(${OGRE_CLAGS_OTHERS} ${BULLET_CLAGS_OTHERS} ${OIS_CLAGS_OTHERS} -Wall -Wno-deprecated)
#ENDIF(WIN32 AND NOT UNIX)


set(OCTREESCENEMANAGER_DIR ./OctreeSceneManager)
set(QUICKGUI_DIR ./QuickGUI)
add_subdirectory(${OCTREESCENEMANAGER_DIR})
add_subdirectory(${QUICKGUI_DIR})
link_directories(${CMAKE_CURRENT_SOURCE_DIR} ${OCTREESCENEMANAGER_DIR}/src ${QUICKGUI}/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${OGRE_INCLUDE_DIRS} ${BULLET_INCLUDE_DIRS} ${OIS_INCLUDE_DIRS} ${OCTREESCENEMANAGER_DIR}/include ${PLANETARYSCENEMANAGER_DIR})

add_executable(ml278 ${ML278_SOURCES})

target_link_libraries(ml278 ${OGRE_LIBRARIES} BulletColladaConverter colladadom libxml ${BULLET_LIBRARIES} ${OIS_LIBRARIES} QuickGUI plugin_octreescenemanager)
add_dependencies(ml278 plugin_octreescenemanager QuickGUI)

INSTALL(TARGETS ml278
	RUNTIME DESTINATION bin
	LIBRARY DESTINATION lib
	ARCHIVE DESTINATION lib/static)
